package com.example.sysinfoacquirerservice.ces;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
@EnableScheduling
public class MyScheduledTask  {
    private final static Logger logger = LoggerFactory.getLogger(MyScheduledTask.class);
    @Scheduled(cron = "0 */2 * * * ?")
    public void ceshi(){
        JSONObject jsonObject = JSON.parseObject(new SysInfoAcquirerService().getNetworkThroughput());
        String txPercent = jsonObject.getString("txPercent");
        String rxPercent = jsonObject.getString("rxPercent");
        logger.debug(txPercent);
        logger.debug(rxPercent);
        System.out.println(txPercent);
        System.out.println(rxPercent);
    }
}
